<style>
    .word{
        line-height: 25px;
        white-space: nowrap;
        display: inline-block;
        height: 25px;
        overflow: hidden;
        cursor: text;
        text-align: left;
        padding: 2px 4px;
        -moz-border-radius: 4px;
        -webkit-border-radius: 4px;
        border-radius: 4px;
        resize: none;
        color: #333333;
        background-color: #FFF;
        border: solid 1px #D7D7D7;
        outline: none;
    }
</style>
<include file="common:__head__"/>
<div class="permissions-tabs">
    <a class="role tabs-bg" href="{:U('express/index')}">运费模板</a>
</div>

<div class="permissions-content">
    <div class="permissions-le">
    <form method="post">
        <input type="hidden" value="ok" name="form_submit">
        <div class="permissions-table">
            <table border="0" width="100%">
                <thead>
                <tr>
                    <td width="10%">ID</td>
                    <td>快递名称</td>
                    <td>快递描述</td>
                    <td>操作</td>
                </tr>
                </thead>
                <div class="add-msg">
                    <a href="{:U('Express/addExpress')}" class="btn btn-green">
                        <span>新增配送方式</span>
                    </a>
                </div>
                <tbody class="trade-setting">
                <foreach name="express" item="vo" key="k" >
                    <tr>
                        <td><div style="text-align: center;">{$vo.id}</div></td>
                        <td>
                           <input class="word" type="text" value="{$vo.e_name}" onchange="changeTableVal_my('express','id','{$vo.id}','e_name',this)"/>
                        </td>
                        <td>
                            <input class="word" type="text" value="{$vo.info}" onchange="changeTableVal_my('express','id','{$vo.id}','info',this)"/>
                        </td>
                        <td>
                            <if condition="$vo['state'] eq 1">
                                <div style="text-align: center;">
                                <a href="{:U('Express/setArea', array('id'=>$vo['id']))}" class="btn btn-blue">设置</a>
                                <a class="btn btn-red del_express" data-id="{$vo['id']}">卸载</a>
                                <else />
                                <a class="btn btn-green install_express" data-id="{$vo['id']}">安装</a>
                                </div>
                            </if>
                        </td>
                    </tr>
                </foreach>
                </tbody>

            </table>
        </div>
    </form>
</div>
<div class="permissions-ri">
    <a href="" class="permissions-help">帮助和服务</a>
</div>
</div>

<script type="text/javascript">
    $(function () {
        //卸载
        $('.del_express').click(function () {
            var _this = $(this);
            layer.confirm('您确认卸载此快递吗？', {
                btn: ['确认','取消']
            }, function(){
                $.ajax({
                    url: "{:U('Express/del')}",
                    type: "post",
                    data: {
                        id: _this.data('id')
                    },
                    beforeSend: function () {
                        layer.msg('卸载快递中..', {icon: 16,time:500});
                    },
                    success: function (msg) {
                        msg==1 ? window.location.href = "{:U('Express/index')}" : layer.msg('卸载失败!', {icon: 2,time:1000});
                    }
                });
            });
        });

        $('.install_express').click(function () {
            var _this = $(this);
            layer.confirm('您确认安装此快递吗？', {
                btn: ['确认','取消']
            }, function(){
                $.ajax({
                    url: "{:U('Express/install')}",
                    type: "post",
                    data: {
                        id: _this.data('id')
                    },
                    beforeSend: function () {
                        layer.msg('安装快递中..', {icon: 16,time:500});
                    },
                    success: function (msg) {
                        msg==1 ? window.location.href = "{:U('Express/index')}" : layer.msg('安装失败!', {icon: 2,time:1000});
                    }
                });
            });
        });
    });
</script>
<include file="common:__foot__"/>